#include<iostream>
#include<stdio.h>
#define MAXN 110
using namespace std;

int Search(int A[], int n) {
	int target = A[0], count = 1;
	for (int i = 1; i < n; ++i) {
		if (target == A[i]) count++;
		else count--;

		if (count < 0) {
			target = A[i];
			count = 1;
		}
	}
	return count > 0 ? target : -1;
}

int main() {
	int A[MAXN] = { 0, 5, 5, 3, 5, 1, 5, 7 };
	int ans = Search(A, 8);
	cout << ans;
	return 0;
}